package github.leavesczy.reactivehttpsamples.core.mode

import com.alibaba.fastjson.annotation.JSONCreator
import github.leavesczy.reactivehttpsamples.R
import java.io.Serializable

data class BridgeRecordData(
    val totalSize: Int?,
    val bodyList: MutableList<BridgeRecordItem>?
)

data class BridgeRecordItem(
    val recordId:Long,
    val bridgeName:String,
    val bridgeCode:String,
    val bridgeType:Int,
    val bridgeMeasureModelNumType0:Int,
    val bridgeMeasureModelNumType1:Int,
    var resultStatus:Int,
    var resultJson:String,
    var images:MutableList<ExtraImage>,
    val neuralNetwork:NeuralNetworkData,
    val identifyCae:IdentifyCaeData,
    val monitorAnalysis:MonitorAnalysisData
):Serializable{
    fun getBridgeTypeString():String{
        if(bridgeType == 1){
            return "梁桥"
        }else if(bridgeType==2){
            return "拱桥"
        }else if(bridgeType==3){
            return "斜拉桥"
        }else if(bridgeType==4){
            return "悬索桥"
        }else{
            return "未知类型"
        }
    }
    fun getResultStatusString():String{
        if(resultStatus == 0){
            return "待分析"
        }else if(resultStatus==1){
            return "分析中"
        }else if(resultStatus==2){
            return "已完成"
        }else if(resultStatus==3){
            return "分析失败"
        }else{
            return "未知状态"
        }
    }
    fun getResultStatusColor():Int{
        if(resultStatus == 0){
            return R.color.cFFFF4960
        }else if(resultStatus==1){
            return R.color.c3C3C3C
        }else if(resultStatus==2){
            return R.color.c02B80A
        }else if(resultStatus==3){
            return R.color.cFFFF4960
        }else{
            return R.color.c7C5C25
        }
    }

    fun getMeasureModelNumType0Str():String{
        return "${bridgeMeasureModelNumType0}个"
    }
    fun getMeasureModelNumType1Str():String{
        return "${bridgeMeasureModelNumType1}个"
    }

    fun isHasResult():Boolean{
        return resultStatus==2
    }
    fun isCanAnalysis():Boolean{
        return resultStatus==0||resultStatus==3
    }
}

data class NeuralNetworkData(
    var girderType:String,
    var mainSpan:String,
    var mainBeamType:String,
    var towerNumber:String,
    var towerHeight:String,
    var resultJson:String
):Serializable

data class IdentifyCaeData(
    var spanArrangement:String,
    var bridgeWidth:String,
    var bridgeLength:String,
    var mainMaterialType:String,
    var unilateralLane:String,
    var bicycleLane:String,
    var sideWalk:String,
    var dividedSection:String,
    var singleBeamInterfaceType:String,
    var constructionYear:String,
    var archBridgeType:String,
    var basketHandleArch:String,
    var archRibNumber:String,
    var archRibHorizontalPalmNumber:String,
    var archRibHorizontalPalmSpace:String,
    var archSectionType:String,
    var archRiseSpanRatio:String,
    var archPillarSpace:String,
    var slingSpace:String,
    var slingNumber:String,
    var stiffeningGirderSectionType:String,
    var stiffeningGirderMaterialType:String,
    var inclinedCableFaceNumber:String,
    var singleSideFaceInclinedCableNumber:String,
    var mainTowerVerticalShape:String,
    var mainTowerHorizontalShape:String,
    var mainTowerFloorUpperLowerHeightRatio:String,
    var mainTowerFloorUpperHeight:String,
    var auxiliaryPier:String,
    var auxiliaryPierNumber:String,
    var mainCableRiseSpanRatio:String,
    var mainCableSpanArrangement:String,
    var anchorDeckHeightDiffOne:String,
    var anchorDeckHeightDiffTwo:String,
    var mainSpanLength:String,
    var mainSpanNumber:String,
    var sideSpanLengthOne:String,
    var anchorSpanLengthOne:String,
    var sideSpanLengthTwo:String,
    var anchorSpanLengthTwo:String,
    var columnNumSpan:String,
    var columnHeight:String,
    var resultJson:String,
):Serializable
data class MonitorAnalysisData(
    val sensorSamplingFrequency:String,
    val measurementSampleNumber:String,
    val measurementSampleIds:String,
    val sampleType:Int,
    val epscCode:String,
    val resultJson:String,
):Serializable

data class ExtraImage(
    val name:String,
    val url:String,
):Serializable

//data class ResultData @JSONCreator constructor(
//    var zxjs:String?,
//    var gypl:String?,
//    var zxznb:String?,
//    var mtzl:String?
//)

data class MeasureModelNumData(
    val numType0:Int,
    val numType1:Int,
){
    fun getNumStr():String{
        return "连续行车${numType0}个，跨中停车${numType1}个"
    }
}

data class MeasureFileSerialNumData(
    val serialNum:Int
){
    fun getNumStr():String{
        return "${serialNum+1}"
    }
}

data class MeasureModelBodyData(
    val bodyList: List<MeasureModelData>
)

data class MeasureModelData(
        val id:Long,
        val bridgeName:String,
        val bridgeCode:String,
        val fileName:String,
        val fileUrl:String,
        val sampleType:Int,
        )